package ro.one.gaeql.parser;

import java.util.HashMap;
import java.util.Map;

import ro.one.gaeql.model.EvalContext;
import ro.one.gaeql.model.ExternalFunction;
import ro.one.gaeql.model.Kind;

import com.google.appengine.api.datastore.Entity;

class EvalContextImpl implements EvalContext {
	Map<Kind, Entity> input;
	Map<String, Kind> aliases;
	
	public EvalContextImpl(Map<Kind, Entity> input, Map<String, Kind> aliases) {
		this.input = input;
		this.aliases = aliases;
	}

	@Override
	public Map<Kind, Map<String, Object>> getEntities() {
		Map<Kind, Map<String, Object>> items = new HashMap<Kind, Map<String,Object>>();
		
		for(Kind k : input.keySet()) {
			items.put(k, input.get(k).getProperties());
		}
		
		return items;
	}

	@Override
	public Map<String, Kind> getAliases() {
		return aliases;
	}

	@Override
	public ExternalFunction getFunction(String name) {
		return null;
	}
}